<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div id="app" class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">发送优惠券</div>
                            </div>
                          
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-3 am-form-label form-require">用户ID </label>
                                <div class="am-u-sm-8 am-u-end">
                                    <input type="text" class="tpl-form-input" name="send[user_id]"
                                           value="" placeholder="请输入用户ID" required>
                                   <small class="am-margin-left-xs">
                                        <a href="<?= url('store/user/index') ?>"
                                           target="_blank">查找id？</a>如需发送多个用户，请使用英文逗号 <code>,</code> 隔开；例如：10001,10002,10003 <text style="color:blue;">如需发送所有用户请输入</text><code>-1</code>
                                    </small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-3 am-form-label form-require">
                                    优惠券
                                </label>
                                <!--<div class="am-u-sm-8 am-u-end">-->
                                <!--    <input type="text" class="tpl-form-input" name="send[coupon_id]"-->
                                <!--           value="" placeholder="请输入ID" required>-->
                                <!--    <small class="am-margin-left-xs">-->
                                <!--        <a href="<?= url('store/market.coupon/index') ?>"-->
                                <!--           target="_blank">查找id？</a>注意此ID，只能填写一个，例如：10002-->
                                <!--    </small>-->
                                <!--</div>-->
                                
                                 <div class="am-u-sm-8 am-u-end">
                        <select name="send[coupon_id]"
                                data-am-selected="{btnSize: 'sm', placeholder: '请选择优惠券'}">
                            <!--<option value="0">无优惠券</option>-->
                            <?php foreach ($list as $item): ?>
                                <option value="<?= $item['coupon_id'] ?>"
                                    <?= $item['coupon_id'] ? 'selected' : '' ?>><?= $item['coupon_id'] . $item['name'] ?>
                                </option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                            </div>
                 

                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">立即发送
                                    </button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>

            </div>
        </div>
    </div>
</div>

<script>
    $(function () {

        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm({
            success: function (result) {
                var content = '';
                // result.data['stateSet'].forEach(function (value) {
                //     content += '<p>' + value + '</p>';
                // });
            //  console.log(result)
                $.showModal({
                    title: '优惠券已发送'
                    , closeBtn: 0
                    , area: '440px'
                    , btn: ['确定']
                    , btnAlign: 'c'
                    , content: '<div class="am-padding x-f-13">' + content + '</div>'
                    , yes: function () {
                        // window.location.reload();
                        return true;
                    }
                });


            }
        });

    });
</script>
